package com.wuyoucar.controller;

import com.wuyoucar.common.ResultBean;
import com.wuyoucar.service.InTBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/*
    1,查询是否绑定银行卡
    2,绑定银行卡
    3,解绑银行卡
 */
@RestController
@RequestMapping("/bank")
public class TBankController {
    @Autowired
    InTBankService tBankService;
    @GetMapping("/selectAllBank/{userid}")
    public ResultBean selectAllBank(@PathVariable("userid") Integer userid){
        return tBankService.selectAllCard(userid);
    }

    //绑定银行卡
    @GetMapping("/bindCard/{userid}/{bankcard}/{cardname}")
    public ResultBean bindCard(@PathVariable("userid") Integer userid,
                               @PathVariable("bankcard") String bankcard,
                               @PathVariable("cardname") String cardname
                             ){
        return tBankService.bindCard(userid,bankcard,cardname);
    }
    //解绑银行卡
    @GetMapping("/delbankcard/{bankcard}")
    public ResultBean delbankcard(@PathVariable("bankcard") String bankcard){
        return tBankService.delbankcard(bankcard);
    }

}
